{extend name="template/base" /}

{block name="style"}
    <link href="//cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
{/block}

{block name="content"}
<div class="pd-10 mt-30">
	<div class="cl pd-5 bg-1 bk-gray"> 
		{if condition="showAuth('admin/AuthGroup/add_proc')"}
			<span class="f-l mr-5">
				<a class="btn btn-primary radius add-btn" data-title="添加用户组" data-url="{:url('add_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加用户组</a>
			</span> 
		{/if}

		{if condition="showAuth('admin/AuthGroup/batch_proc')"}
			{if condition="showAuth('admin/AuthGroup/delete')"}
				<span class="f-l mr-5">
					<a class="btn btn-danger batch-btn radius" data-title="删除" data-type="delete" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
				</span>
			{/if}

			<span class="f-l mr-5">
				<a class="btn btn-danger-outline batch-btn radius" data-title="禁用" data-type="disable" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe631;</i> 批量禁用</a>
			</span> 

			<span class="f-l mr-5">
				<a class="btn btn-success-outline batch-btn radius" data-title="恢复" data-type="enable" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe6a8;</i> 批量恢复</a>
			</span> 
		{/if}
	</div>
	<!-- 搜索框 -->
	<div class="pd-5 bg-1 bk-gray">
		<form action="{:url('/admin/auth_group/index')}" class="form-inline" role="form" id="search-form">
			<input name="title" value="{$title}" type="text" class="form-control"  placeholder="用户组名称">

			<div class="radio-box">
				<input type="radio" id="s-1" name="status" value="1" {$status==1? 'checked' : ''}>
				<label for="s-1">启用</label>
			</div>
			<div class="radio-box">
				<input type="radio" id="s-2" name="status" value="2" {$status==2? 'checked' : ''}>
				<label for="s-2">禁用</label>
			</div>

			<button type="submit" class="btn btn-secondary radius">搜索  </button>
			<button type="reset" class="btn btn-default radius">重置  </button>

		</form>
	</div>
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr>
				<th scope="col" colspan="6" class="text-c"><h3>用户组列表</h3></th>
			</tr>
			<tr class="text-c">
				<th width="10%">
				    <input type="checkbox" id="checkbox-1" class="">
				    <label for="checkbox-1">全选</label>
				</th>
				<th width="20%">用户组名</th>
				<th width="20%">状态</th>
				<th width="50%">操作</th>
			</tr>
		</thead>
		<tbody>
		{volist name="info" id="v"}
			<tr class="text-c">
				<td width="5%"><input type="checkbox" name="group_id[]" class="index-chkbox" value="{$v.id}" /></td>
				<td>{$v.title}</td>
				<td>{$v.status? '<span class="label label-success radius">启用</span>' : '<span class="label label-danger radius">禁用</span>'}</td>
				<td>
					{if condition="showAuth('admin/AuthGroup/set_auth')"}
					<input class="btn btn-primary  radius  size-S set-btn" type="button" save-url="{:url('save_auth')}" set-url="{:url('set_auth',['id'=>$v.id])}" data-title="设置用户组规则"  value="设置规则">
					{/if}
					{if condition="showAuth('admin/AuthGroup/add_proc')"}
					<input class="btn btn-default  radius  size-S edit-btn" data-url="{:url('add_proc')}" type="button" data-title="编辑用户组" data-id="{$v.id}" data-name="{$v.title}" data-status="{$v.status}" data-isdelete="{$v.isdelete}" value="编辑">
					{/if}
					{if condition="showAuth('admin/AuthGroup/delete')"}
					{if condition="$v.isdelete"}
					<input class="btn btn-danger  radius  size-S delete-btn" data-url="{:url('delete')}" data-id="{$v.id}" type="button"  value="删除">
					{/if}
					{/if}
					{if condition="showAuth('admin/AuthGroup/set_user')"}
					<input class="btn btn-success  radius  size-S set-btn" type="button" save-url="{:url('save_user')}" set-url="{:url('set_user',['id'=>$v.id])}" data-title="设置用户组成员"  value="设置成员">
					{/if}
				</td>
			</tr>
		{/volist}
		</tbody>
	</table>
	<!-- 分页 -->
	<div class="ml-10">
	    {$info->render()}
	</div>
</div>

<!-- 添加、编辑弹框 -->
<div id="group-new-page" style="display: none;">
	<form class="form form-horizontal" id="add-group-form" >
		<input type="hidden" name="group_id" id="group-id" value="">
		
		<div class="row cl">
		    <label class="form-label col-xs-3 col-ms-3">组名称</label>
		    <div class="formControls col-xs-6 col-ms-6">
		        <input name="title" type="text" id="group-title" placeholder="请输入管理组名称" value="" class="input-text radius group-title">
		    </div>
		</div>

		<div class="row cl">
		    <label class="form-label col-xs-3 col-ms-3">状态</label>
		    <div class="skin-minimal">
		      <div class="radio-box">
		        <input type="radio" id="status-1" class="ara-radio" name="status" value="1" />
		        <label for="status-1">开启</label>
		      </div>
		      <div class="radio-box">
		        <input type="radio" id="status-2" class="ara-radio" name="status" value="0">
		        <label for="status-2">禁用</label>
		      </div>
		    </div>
		</div>

		<div class="row cl">
		    <label class="form-label col-xs-3 col-ms-3">能否删除</label>
		    <div class="skin-minimal">
		      <div class="radio-box">
		        <input type="radio" id="isdelete-1" class="ara-radio" name="isdelete" value="1" />
		        <label for="isdelete-1">可以</label>
		      </div>
		      <div class="radio-box">
		        <input type="radio" id="isdelete-2" class="ara-radio" name="isdelete" value="0">
		        <label for="isdelete-2">不能</label>
		      </div>
		    </div>
		</div>
	</form>
</div>


{/block}



{block name="script"}
	<script type="text/javascript" src="__AJS__/auth_group/index.js"></script>
{/block}